package ch.usi.inf.pf2.gui.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import ch.usi.inf.pf2.gui.JSpreadSheetGUI;
import ch.usi.inf.pf2.gui.SpreadSheetFileManager;


/**
 * Listener for the menu and button "Save"
 * 
 * @author Lorenzo Baracchi, Ebrisa Savina Mastrodicasa
 *
 */



public class SaveActionListener implements ActionListener
{

    private JSpreadSheetGUI spreadTable;
    
    public SaveActionListener (JSpreadSheetGUI spreadTable)
    {
	   this.spreadTable=spreadTable;
    }
    
    @Override
    public void actionPerformed(ActionEvent e)
    {
	   SpreadSheetFileManager.saveFile(spreadTable.getSheet(), spreadTable.getSheet().getName());
	   spreadTable.getSheet().setHasBeenSaved(true);
    }

}
